<template>
  <el-container class="full-container">
    <!-- 侧边栏 -->
    <el-aside width="250px" class="sidebar">
      <HistoryPanel />
    </el-aside>
    <!-- 主容器 -->
    <el-container direction="vertical" class="main-container">
      <el-main class="main-content">
        <MyRequest @response-updated="updateResponse" />
      </el-main>
      <!-- 底部容器 -->
      <el-footer class="footer-content">
        <MyResponse :response="response" />
      </el-footer>
    </el-container>
  </el-container>
</template>

<script>
import MyRequest from "../components/MyRequest.vue";
import HistoryPanel from "../components/HistoryPanel.vue";
import MyResponse from "../components/MyResponse.vue";

export default {
  name: 'App',
  components: {
    MyRequest,
    MyResponse,
    HistoryPanel,
  },
  data() {
    return {
      response: null, // 存储 MyRequest 组件传递过来的响应数据（JSON）
    };
  },
  methods: {
    updateResponse(responseData) {
      this.response = responseData; // 更新 response 数据
    },
  },
};
</script>

<style scoped>
/* 确保 el-container 填满整个页面 */
.full-container {
  height: 100vh; /* 占满整个视口高度 */
  display: flex;
}

/* 侧边栏填满高度 */
.sidebar {
  height: 100%; /* 侧边栏高度填满父容器 */
}

/* 主容器和底部容器也应占满剩余空间 */
.main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* 主内容区域 */
.main-content {
  flex: 1;
  overflow: auto; /* 添加滚动条 */
}

/* 底部内容区域 */
.footer-content {
  flex: 0 0 auto;
}
</style>